HAL PSSI migration: List of applicable concepts

This section provides information about the HAL PSSI applicable architecture concepts.

Concepts for PSSI

Concept

Description

Separation of initialization and configuration functions

The initialization has been split into separate init and config steps:

  • HAL_PSSI_Init(): initializes the handle and links it to a PSSI instance.

  • HAL_PSSI_SetConfig(): sets the configuration for the PSSI peripheral.

Removal and conversion of init structure to configuration structure

The legacy init structure has been removed. Configuration is expressed through typed structs passed to feature-specific APIs.

Renaming of the handle structure

The handle structure has been renamed to hal_pssi_handle_t.

Renaming unitary init structures

The structure PSSI_InitTypeDef has been replaced by hal_pssi_config_t and dedicated configuration structures.

Remove MspInit and MspDeInit callbacks

The functions HAL_PSSI_MspInit() and HAL_PSSI_MspDeInit() have been replaced by a user-defined sequence for PSSI initialization and configuration.

Unitary configuration APIs

New APIs have been introduced to get and set PSSI features.

Dedicated DMA link APIs replace generic __HAL_LINKDMA macro

DMA configuration and linking are explicit using PSSI APIs:

  • HAL_PSSI_SetTxDMA() and HAL_PSSI_SetRxDMA() to attach a DMA channel to PSSI.

  • Dedicated PSSI functions manage DMA usage; configuration details are handled within the PSSI migration sequences.

Individual callback registration APIs replace global register and unregister functions

The callback registration is handled by specific functions for each PSSI event. These functions are used to register callback functions for different PSSI events.

Revised and optimized HAL state machine

The PSSI state machine has been reworked to ensure transitions of the peripheral functional states.

Revised and optimized HAL API status returns

The HAL PSSI functions were updated to return:

  • HAL_INVALID_PARAM: in case of a NULL p_config structure pointer.

  • HAL_ERROR: in case of an error.

  • HAL_TIMEOUT: in case of a user timeout.

  • HAL_BUSY: in case of an ongoing process.

  • HAL_OK: in case of a successfully completed operation.

Revised and optimized HAL error management

Rename the error management function to HAL_PSSI_GetLastErrorCodes().

Replaced TypeDef suffix with _t in type names

All TypeDef parts of the HAL PSSI driver have been removed and replaced by _t.

Replaced nonmodifiable pointers with const keywords

Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable.

Assertion implementation and usage in HAL1

The parameters and state are checked using ASSERT_DBG_STATE and ASSERT_DBG_PARAM macros.

Provide RTOS-compatible acquire/release bus services for communication peripheral drivers.

New functions, HAL_PSSI_AcquireBus() and HAL_PSSI_ReleaseBus(), are provided to allow the acquisition and release of a HAL PSSI handle, protecting an entire sequence.

Add HAL PPP Services for Drivers with Handle to Retrieve Corresponding Peripheral Clock Frequency.

The HAL PSSI driver provides a new API to retrieve the clock frequency: HAL_PSSI_GetClockFreq().

Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.

Finite parameters (including PSSI instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety.

Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions).

All HAL PSSI APIs start with HAL_PSSI.